package com.kun.portal.webframe.controller;

import com.kun.portal.webframe.po.CourseNodeBasePo;
import com.kun.portal.webframe.service.ProcessMgrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Administrator on 2018-09-06.
 */
@Controller
@RequestMapping({"/api/sysSetting"})
public class ProcessMgrController {
    @Autowired
    private ProcessMgrService processMgrService;
    @InitBinder
    public void intDate(WebDataBinder dataBinder){
        dataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
    }
    @RequestMapping(
            value = {"/findCnb"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List findAllCnb(){
        return processMgrService.findAllCnb();
    }


    @RequestMapping(
            value = {"/saveCnb"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void saveCnb(@RequestBody CourseNodeBasePo courseNodeBasePo){
        processMgrService.saveCnb(courseNodeBasePo);
    }

    @RequestMapping(
            value = {"/delectCnb"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void deleteGnb(@RequestBody CourseNodeBasePo courseNodeBasePo){
        processMgrService.deleteCnb(courseNodeBasePo);
    }


}
